{{useCss "/app-pages/css/user/info.scss"}}
<div class="userinfo">
    <div class="nav">
        <div class="nav-li focus">个人信息</div>
        {{#if !$Cache.user.userinfo.is_edit}}
        <div value="true" class="nav-li" event-click="{{'$Event.user.userinfo.to_edit'}}">修改</div>
        <href to="/user/changepwd.html">
            <div class="nav-li">修改密码</div>
        </href>
        {{#else}}
        <div value="true" class="nav-li" event-click="{{'$Event.user.userinfo.post_edit'}}">完成</div>
        <div value="true" class="nav-li" event-click="{{'$Event.user.userinfo.cancel_edit'}}">取消</div>
        {{/if}}
    </div>

    <hr />

    <div class="info_box">
        <div class="table">
            {{#if !$Cache.user.userinfo.is_edit}}
            <div class="item">
                <div class="title">头像：</div>
                <div class="textitem">
                    <span class="text userlogo">
                        <img bind-src="{{loginer.info.header_url||'/images/default_head.jpg'}}">
                    </span>
                </div>
            </div>
            <div class="item">
                <div class="title">昵称：</div>
                <div class="textitem">
                    <span class="text">{{loginer.info.name}}</span>
                </div>
            </div>
            <div class="item">
                <div class="title">绑定手机：</div>
                <div class="textitem">
                    <span class="text">{{loginer.info.mobile_phone}}</span>
                </div>
            </div>
            <div class="item">
                <div class="title">绑定邮箱：</div>
                <div class="textitem">
                    <span class="text">{{loginer.info.email}}</span>
                </div>
            </div>
            <div class="item">
                <div class="title">身份证：</div>
                <div class="textitem">
                    <span class="text">{{loginer.info.id_card}}</span>
                </div>
            </div>
            <div class="item" title="在申请兑现时使用">
                <div class="title">支付宝账号：</div>
                <div class="textitem">
                    <span class="text">{{loginer.info.alipay}}</span>
                </div>
            </div>
            {{#else}}
            <div class="item">
                <div class="title">头像：</div>
                <div class="textitem">
                    <span class="text userlogo">
                        <img bind-src="{{loginer.info.header_url||'/images/default_head.jpg'}}">
                    </span>
                    <img-uploader text="选择封面" bind-input-key="loginer.info.header_url" one-way="true" style="display:inline-block;" max-width="512">
                    </img-uploader>
                </div>
            </div>
            <div class="item">
                <div class="title">昵称：</div>
                <div class="textitem">
                    <span class="text">{{loginer.info.name}}</span>
                </div>
            </div>
            <div class="item">
                <div class="title">绑定手机：</div>
                <div class="textitem">
                    <span class="text">
                        <input type="text" value="{{loginer.info.mobile_phone}}" bind-input="{{'loginer.info.mobile_phone'}}">
                    </span>
                </div>
            </div>
            <div class="item">
                <div class="title">绑定邮箱：</div>
                <div class="textitem">
                    <span class="text">
                        <input type="text" value="{{loginer.info.email}}" bind-input="{{'loginer.info.email'}}">
                    </span>
                </div>
            </div>
            <div class="item">
                <div class="title">身份证：</div>
                <div class="textitem">
                    <span class="text">
                        <input type="text" value="{{loginer.info.id_card}}" bind-input="{{'loginer.info.id_card'}}">
                    </span>
                </div>
            </div>
            <div class="item" title="在申请兑现时使用">
                <div class="title">支付宝账号：</div>
                <div class="textitem">
                    <span class="text">
                        <input type="text" value="{{loginer.info.alipay}}" bind-input="{{'loginer.info.alipay'}}">
                    </span>
                </div>
            </div>
            <div class="item" title="微信中自动登录用">
                <div class="title">绑定微信号：</div>
                <div class="textitem">
                    <span class="text">
                        <input type="text" value="{{loginer.info.weixin_unionid}}" bind-input="{{'loginer.info.weixin_unionid'}}">
                    </span>
                </div>
            </div>
            {{/if}}

        </div>
    </div>
</div>
<xmp type="template" name="personalinfo.id_card">
    <span>{{$Private.id_card}}</span>
</xmp>

<script type="text/vm" name="personalinfo.id_card">
    function (vm) {
        vm.set("$Private.id_card",Model.Observer(function () {
            var id_card = vm.get("$This")||"";
            return id_card.substr(6)+"******"+id_card.substr(6);
        }));
        // debugger
        vm.model.onfollow = function () {
            debugger
            vm.get("$Private.id_card");
            vm.model.touchOff("$Private.id_card");
        }
    }
</script>